<?php

namespace App\Services\DingDing;

use Illuminate\Support\Facades\Log;


use AlibabaCloud\SDK\Dingtalk\Vworkflow_1_0\Dingtalk;
use \Exception;
use AlibabaCloud\Tea\Exception\TeaError;
use AlibabaCloud\Tea\Utils\Utils;

use Darabonba\OpenApi\Models\Config;
use AlibabaCloud\SDK\Dingtalk\Vworkflow_1_0\Models\QuerySchemaByProcessCodeHeaders;
use AlibabaCloud\SDK\Dingtalk\Vworkflow_1_0\Models\QuerySchemaByProcessCodeRequest;
use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;

class DingDingOaSer
{

    public static function createClient(){
        $config = new Config([]);
        $config->protocol = "https";
        $config->regionId = "central";
        return new Dingtalk($config);
    }

    public static function getschemas(){
        $access_token=DingDingSer::getAccessToken();
        $client = self::createClient();
        $querySchemaByProcessCodeHeaders = new QuerySchemaByProcessCodeHeaders([]);
        $querySchemaByProcessCodeHeaders->xAcsDingtalkAccessToken = $access_token;
        $querySchemaByProcessCodeRequest = new QuerySchemaByProcessCodeRequest([
            "processCode" => "PROC-84F34D20-6006-44E9-BBEC-FB5DB03159D4"
        ]);
        try {
            $res=$client->querySchemaByProcessCodeWithOptions($querySchemaByProcessCodeRequest, $querySchemaByProcessCodeHeaders, new RuntimeOptions([]));
            echo json_encode($res->body);exit;
            print_r(json_decode(json_encode($res->body),true));
        }
        catch (Exception $err) {
            if (!($err instanceof TeaError)) {
                $err = new TeaError([], $err->getMessage(), $err->getCode(), $err);
            }
            if (!Utils::empty_($err->code) && !Utils::empty_($err->message)) {
                // err 中含有 code 和 message 属性，可帮助开发定位问题
            }
        }
        /**
         * 

{"result":{"appType":0,"appUuid":"ding73f4d3b49bbf1098f5bf40eda33b7ba0","bizType":"","creatorUserId":"2908245207679697","customSetting":null,"engineType":0,"formCode":"PROC-84F34D20-6006-44E9-BBEC-FB5DB03159D4","formUuid":"FORM-E6168584-5E58-461C-B45E-614398355636","gmtCreate":"2024-05-11T14:00Z","gmtModified":"2024-11-11T16:59Z","icon":"https:\/\/img.alicdn.com\/imgextra\/i2\/O1CN01r8CMaY1suojEoDna3_!!6000000005827-0-tps-480-480.jpg","listOrder":45,"memo":"","name":"BH\u9500\u552e\u9000\u6b3e\u5355","ownerIdType":"orgId","procType":"inner","schemaContent":{"icon":"common","items":[{"children":null,"componentName":"TextField","props":{"actionName":null,"align":null,"appId":null,"asyncCondition":null,"attendTypeLabel":null,"behaviorLinkage":null,"bizAlias":"","bizType":null,"childFieldVisible":null,"choice":null,"commonBizType":null,"disabled":null,"duration":null,"durationLabel":null,"eSign":null,"extract":null,"fieldsInfo":null,"format":null,"formula":null,"hidden":null,"hiddenInApprovalDetail":null,"hideLabel":null,"holidayOptions":null,"id":"TextField_1N88VPCVDY000","label":"\u5ba2\u6237\u540d\u79f0","labelEditableFreeze":null,"link":null,"mainTitle":null,"notPrint":null,"notUpper":null,"objOptions":null,"options":null,"payEnable":null,"placeholder":"\u7cfb\u7edf\u4ee3\u5165","push":{"attendanceRule":null,"pushSwitch":null,"pushTag":null},"pushToAttendance":null,"pushToCalendar":null,"required":true,"requiredEditableFreeze":null,"showAttendOptions":null,"staffStatusEnabled":false,"statField":null,"tableViewMode":null,"unit":null,"useCalendar":null,"verticalPrint":null}},{"children":null,"componentName":"DDSelectField","props":{"actionName":null,"align":null,"appId":null,"asyncCondition":null,"attendTypeLabel":null,"behaviorLinkage":null,"bizAlias":"","bizType":null,"childFieldVisible":null,"choice":null,"commonBizType":null,"disabled":null,"duration":null,"durationLabel":null,"eSign":null,"extract":null,"fieldsInfo":"[]","format":null,"formula":null,"hidden":null,"hiddenInApprovalDetail":null,"hideLabel":null,"holidayOptions":null,"id":"DDSelectField_S2U1QFGM3WW0","label":"\u9000\u6b3e\u7c7b\u578b","labelEditableFreeze":null,"link":null,"mainTitle":null,"notPrint":null,"notUpper":null,"objOptions":null,"options":["{\"value\":\"\u591a\u529e\u9700\u9000\",\"key\":\"option_0\"}","{\"value\":\"\u529e\u9519\u9700\u9000\",\"key\":\"option_1\"}","{\"value\":\"\u4e8f\u5428\u8865\u507f\",\"key\":\"option_2\"}"],"payEnable":null,"placeholder":"\u8bf7\u9009\u62e9","push":{"attendanceRule":null,"pushSwitch":null,"pushTag":null},"pushToAttendance":null,"pushToCalendar":null,"required":true,"requiredEditableFreeze":null,"showAttendOptions":null,"staffStatusEnabled":false,"statField":null,"tableViewMode":null,"unit":null,"useCalendar":null,"verticalPrint":null}},{"children":null,"componentName":"TextField","props":{"actionName":null,"align":null,"appId":null,"asyncCondition":null,"attendTypeLabel":null,"behaviorLinkage":null,"bizAlias":"","bizType":null,"childFieldVisible":null,"choice":null,"commonBizType":null,"disabled":null,"duration":null,"durationLabel":null,"eSign":null,"extract":null,"fieldsInfo":null,"format":null,"formula":null,"hidden":null,"hiddenInApprovalDetail":null,"hideLabel":null,"holidayOptions":null,"id":"TextField_1OM68QFLTN5S0","label":"\u4ed8\u6b3e\u94f6\u884c","labelEditableFreeze":null,"link":null,"mainTitle":null,"notPrint":null,"notUpper":null,"objOptions":null,"options":null,"payEnable":null,"placeholder":"\u7cfb\u7edf\u4ee3\u5165\u7ed3\u7b97\u516c\u53f8","push":{"attendanceRule":null,"pushSwitch":null,"pushTag":null},"pushToAttendance":null,"pushToCalendar":null,"required":true,"requiredEditableFreeze":null,"showAttendOptions":null,"staffStatusEnabled":false,"statField":null,"tableViewMode":null,"unit":null,"useCalendar":null,"verticalPrint":null}},{"children":null,"componentName":"TextField","props":{"actionName":null,"align":null,"appId":null,"asyncCondition":null,"attendTypeLabel":null,"behaviorLinkage":null,"bizAlias":"","bizType":null,"childFieldVisible":null,"choice":null,"commonBizType":null,"disabled":null,"duration":null,"durationLabel":null,"eSign":null,"extract":null,"fieldsInfo":null,"format":null,"formula":null,"hidden":null,"hiddenInApprovalDetail":null,"hideLabel":null,"holidayOptions":null,"id":"TextField_53HKMPG40VW0","label":"\u6237\u540d","labelEditableFreeze":null,"link":null,"mainTitle":null,"notPrint":null,"notUpper":null,"objOptions":null,"options":null,"payEnable":null,"placeholder":"\u7cfb\u7edf\u4ee3\u5165\u5bf9\u5e94\u5ba2\u6237\u57fa\u7840\u8d44\u6599","push":{"attendanceRule":null,"pushSwitch":null,"pushTag":null},"pushToAttendance":null,"pushToCalendar":null,"required":true,"requiredEditableFreeze":null,"showAttendOptions":null,"staffStatusEnabled":false,"statField":null,"tableViewMode":null,"unit":null,"useCalendar":null,"verticalPrint":null}},{"children":null,"componentName":"TextField","props":{"actionName":null,"align":null,"appId":null,"asyncCondition":null,"attendTypeLabel":null,"behaviorLinkage":null,"bizAlias":"","bizType":null,"childFieldVisible":null,"choice":null,"commonBizType":null,"disabled":null,"duration":null,"durationLabel":null,"eSign":null,"extract":null,"fieldsInfo":null,"format":null,"formula":null,"hidden":null,"hiddenInApprovalDetail":null,"hideLabel":null,"holidayOptions":null,"id":"TextField_1W8JUTJ3H5J40","label":"\u8d26\u53f7","labelEditableFreeze":null,"link":null,"mainTitle":null,"notPrint":null,"notUpper":null,"objOptions":null,"options":null,"payEnable":null,"placeholder":"\u7cfb\u7edf\u4ee3\u5165\u5bf9\u5e94\u5ba2\u6237\u57fa\u7840\u8d44\u6599","push":{"attendanceRule":null,"pushSwitch":null,"pushTag":null},"pushToAttendance":null,"pushToCalendar":null,"required":true,"requiredEditableFreeze":null,"showAttendOptions":null,"staffStatusEnabled":false,"statField":null,"tableViewMode":null,"unit":null,"useCalendar":null,"verticalPrint":null}},{"children":null,"componentName":"TextField","props":{"actionName":null,"align":null,"appId":null,"asyncCondition":null,"attendTypeLabel":null,"behaviorLinkage":null,"bizAlias":"","bizType":null,"childFieldVisible":null,"choice":null,"commonBizType":null,"disabled":null,"duration":null,"durationLabel":null,"eSign":null,"extract":null,"fieldsInfo":null,"format":null,"formula":null,"hidden":null,"hiddenInApprovalDetail":null,"hideLabel":null,"holidayOptions":null,"id":"TextField_13LJJYFGPNMK0","label":"\u5f00\u6237\u884c","labelEditableFreeze":null,"link":null,"mainTitle":null,"notPrint":null,"notUpper":null,"objOptions":null,"options":null,"payEnable":null,"placeholder":"\u7cfb\u7edf\u4ee3\u5165\u5bf9\u5e94\u5ba2\u6237\u57fa\u7840\u8d44\u6599","push":{"attendanceRule":null,"pushSwitch":null,"pushTag":null},"pushToAttendance":null,"pushToCalendar":null,"required":true,"requiredEditableFreeze":null,"showAttendOptions":null,"staffStatusEnabled":false,"statField":null,"tableViewMode":null,"unit":null,"useCalendar":null,"verticalPrint":null}},{"children":null,"componentName":"TextField","props":{"actionName":null,"align":null,"appId":null,"asyncCondition":null,"attendTypeLabel":null,"behaviorLinkage":null,"bizAlias":"","bizType":null,"childFieldVisible":null,"choice":null,"commonBizType":null,"disabled":null,"duration":null,"durationLabel":null,"eSign":null,"extract":null,"fieldsInfo":null,"format":null,"formula":null,"hidden":null,"hiddenInApprovalDetail":null,"hideLabel":null,"holidayOptions":null,"id":"TextField_1BC199ZZ2J9C0","label":"\u5f00\u6237\u884c\u884c\u53f7","labelEditableFreeze":null,"link":null,"mainTitle":null,"notPrint":null,"notUpper":null,"objOptions":null,"options":null,"payEnable":null,"placeholder":"\u7cfb\u7edf\u4ee3\u5165\uff08\u5982\u6709\uff09","push":{"attendanceRule":null,"pushSwitch":null,"pushTag":null},"pushToAttendance":null,"pushToCalendar":null,"required":false,"requiredEditableFreeze":null,"showAttendOptions":null,"staffStatusEnabled":false,"statField":null,"tableViewMode":null,"unit":null,"useCalendar":null,"verticalPrint":null}},{"children":null,"componentName":"NumberField","props":{"actionName":null,"align":null,"appId":null,"asyncCondition":null,"attendTypeLabel":null,"behaviorLinkage":null,"bizAlias":"","bizType":null,"childFieldVisible":null,"choice":null,"commonBizType":null,"disabled":null,"duration":null,"durationLabel":null,"eSign":null,"extract":null,"fieldsInfo":null,"format":null,"formula":null,"hidden":null,"hiddenInApprovalDetail":null,"hideLabel":null,"holidayOptions":null,"id":"NumberField_1SLJQ4IQ94E80","label":"\u9000\u6b3e\u91d1\u989d","labelEditableFreeze":null,"link":null,"mainTitle":null,"notPrint":null,"notUpper":null,"objOptions":null,"options":null,"payEnable":null,"placeholder":"\u7cfb\u7edf\u5e26\u5165\uff0c\u53ef\u4fee\u6539","push":{"attendanceRule":null,"pushSwitch":null,"pushTag":null},"pushToAttendance":null,"pushToCalendar":null,"required":true,"requiredEditableFreeze":null,"showAttendOptions":null,"staffStatusEnabled":false,"statField":null,"tableViewMode":null,"unit":"\u5143","useCalendar":null,"verticalPrint":null}},{"children":null,"componentName":"DDSelectField","props":{"actionName":null,"align":null,"appId":null,"asyncCondition":null,"attendTypeLabel":null,"behaviorLinkage":null,"bizAlias":"","bizType":null,"childFieldVisible":null,"choice":null,"commonBizType":null,"disabled":null,"duration":null,"durationLabel":null,"eSign":null,"extract":null,"fieldsInfo":"[]","format":null,"formula":null,"hidden":null,"hiddenInApprovalDetail":null,"hideLabel":null,"holidayOptions":null,"id":"DDSelectField_QM5MQCXJ1EO0","label":"\u52a0\u6025\u6807\u5fd7","labelEditableFreeze":null,"link":null,"mainTitle":null,"notPrint":"1","notUpper":null,"objOptions":null,"options":["{\"value\":\"\u6b63\u5e38\u529e\u7406\",\"key\":\"option_0\"}","{\"value\":\"\u5df2\u7b54\u5e94\u4e0a\u5348\u529e\u7406\",\"key\":\"option_1\"}","{\"value\":\"\u5df2\u7b54\u5e94\u4e0b\u5348\u529e\u7406\",\"key\":\"option_2\"}","{\"extension\":{\"image\":\"\"},\"value\":\"\u4eca\u5929\u529e\u7406\u5373\u53ef\",\"key\":\"option_ETNIXA1AJGW0\"}","{\"extension\":{\"image\":\"\"},\"value\":\"\u4eca\u660e\u4e24\u5929\u529e\u6e05\",\"key\":\"option_C108WFRKLCW0\"}","{\"extension\":{\"image\":\"\"},\"value\":\"\u52a0\u6025\",\"key\":\"option_4Q3AO42UB2U0\"}"],"payEnable":null,"placeholder":"\u8bf7\u9009\u62e9","push":{"attendanceRule":null,"pushSwitch":null,"pushTag":null},"pushToAttendance":null,"pushToCalendar":null,"required":true,"requiredEditableFreeze":null,"showAttendOptions":null,"staffStatusEnabled":false,"statField":null,"tableViewMode":null,"unit":null,"useCalendar":null,"verticalPrint":null}},{"children":null,"componentName":"DDSelectField","props":{"actionName":null,"align":null,"appId":null,"asyncCondition":null,"attendTypeLabel":null,"behaviorLinkage":null,"bizAlias":"","bizType":null,"childFieldVisible":null,"choice":null,"commonBizType":null,"disabled":null,"duration":null,"durationLabel":null,"eSign":null,"extract":null,"fieldsInfo":"[]","format":null,"formula":null,"hidden":null,"hiddenInApprovalDetail":null,"hideLabel":null,"holidayOptions":null,"id":"DDSelectField_1YUGM8JKJ85C0","label":"\u4ed8\u6b3e\u56de\u5355","labelEditableFreeze":null,"link":null,"mainTitle":null,"notPrint":null,"notUpper":null,"objOptions":null,"options":["{\"value\":\"\u4e0d\u8981\u4e5f\u53ef\u4ee5\",\"key\":\"option_0\"}","{\"value\":\"\u5fc5\u987b\u8981\u56de\u5355\",\"key\":\"option_1\"}"],"payEnable":null,"placeholder":"\u51fa\u7eb3\u590d\u5236\u7c98\u8d34\u5230\u7cfb\u7edf","push":{"attendanceRule":null,"pushSwitch":null,"pushTag":null},"pushToAttendance":null,"pushToCalendar":null,"required":false,"requiredEditableFreeze":null,"showAttendOptions":null,"staffStatusEnabled":false,"statField":null,"tableViewMode":null,"unit":null,"useCalendar":null,"verticalPrint":null}},{"children":null,"componentName":"DDAttachment","props":{"actionName":null,"align":null,"appId":null,"asyncCondition":null,"attendTypeLabel":null,"behaviorLinkage":null,"bizAlias":"","bizType":null,"childFieldVisible":null,"choice":null,"commonBizType":null,"disabled":null,"duration":null,"durationLabel":null,"eSign":null,"extract":null,"fieldsInfo":null,"format":null,"formula":null,"hidden":null,"hiddenInApprovalDetail":null,"hideLabel":null,"holidayOptions":null,"id":"DDAttachment_107HW61E56PS0","label":"\u5408\u540c\u53ca\u529e\u6b3e\u4fe1\u606f\uff0c\u7cfb\u7edf\u4ee3\u5165","labelEditableFreeze":null,"link":null,"mainTitle":null,"notPrint":null,"notUpper":null,"objOptions":null,"options":null,"payEnable":null,"placeholder":null,"push":{"attendanceRule":null,"pushSwitch":null,"pushTag":null},"pushToAttendance":null,"pushToCalendar":null,"required":false,"requiredEditableFreeze":null,"showAttendOptions":null,"staffStatusEnabled":false,"statField":null,"tableViewMode":null,"unit":null,"useCalendar":null,"verticalPrint":null}}],"title":"BH\u9500\u552e\u9000\u6b3e\u5355"},"status":"PUBLISHED","visibleRange":"PRIVATE"}}
         */
    }
}